﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using CustomsSystem.BLL;
using CustomsSystem.Model;
using System.Collections.Generic;
namespace WEB.score
{
    public partial class handleView : System.Web.UI.Page
    {
        ScoreManage scoreManage = new ScoreManage();
        CustomsSystem.Model.Score myScore = new CustomsSystem.Model.Score();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.QueryString["ID"] != null)   //评价
                {
                    int id = Convert.ToInt32(Request.QueryString["ID"]);
                    myScore = scoreManage.GetModel(id);
                    if (myScore == null)
                    {
                        Response.Write("<script>alert('该业务还没有被评价，请您先评价')</script>");
                        Response.Write("<script>window.document.location.href='/Client/ClientSheetView.aspx'</script>");
                    }
                    else if (scoreManage.Revise(myScore) == false)
                    {
                        Response.Write("<script>alert('亲爱的客户，真不好意思，您的反馈意见暂时还没被回复!')</script>");
                        Response.Write("<script>window.document.location.href='/Client/ClientSheetView.aspx'</script>");
                    }
                    else
                    {
                        sheetID.Text = myScore.sheetID.ToString();
                        if (myScore.score == 1)
                        {
                            SelectScore1.Checked = true;
                        }
                        else if (myScore.score == 3)
                        {
                            SelectScore3.Checked = true;
                        }
                        else if (myScore.score == 4)
                        {
                            SelectScore4.Checked = true;
                        }
                        else if (myScore.score == 5)
                        {
                            SelectScore5.Checked = true;
                        }
                        suggest.Value = myScore.suggest;
                        handle.Text = myScore.handle;
                    }
                }
                else
                {
                    Response.Write("<script>alert('没有对应的委托单!')</script>");
                }
            }
        }

        protected void Return_Click(object sender, EventArgs e)
        {
            Response.Redirect("/Client/ClientSheetView.aspx");
        }
    }
}